$(function(){
    var status=0;//检测点击按钮  0为点击返回，1为点击继续
    $("#form-customer-add").Validform({
    tiptype:2,
    ajaxPost:true,
    showAllError:true,
    beforeSubmit:function(curform){

        curform.ajaxSubmit({
        type:'POST',
        url:'/index.php?m=Admin&c=Customer&a=add',
        success:function(data){
          console.log(status);
          if(data.stat==1){
            if(status==1){
              layer.msg("添加成功");
              // $("#form-customer-add")[0].reset();
              location.replace(location.href);
            }else{
              layer.msg("添加成功");
              var index = parent.layer.getFrameIndex(window.name);
              setTimeout(function(){
                   parent.layer.close(index);
              },1000);
              parent.location.reload();
            }
          }else{
            layer.msg(data.msg);
          }
          }
        });
     return false; 
    }
  });
    // 继续按钮，则status置为1 反之置为0；                  
  $(document).on("click",".subjx",function(){
    status=1;
  });
  $(document).on("click",".subfh",function(){
    status=0;
  });
});